import com.alibaba.fastjson.JSON;
import com.cangshi.entity.Task;
import com.cangshi.mail.MailManage;
import com.cangshi.service.TaskService;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.mail.MessagingException;
import java.security.GeneralSecurityException;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by 15c on 2017/4/3.
 */
@RunWith(SpringJUnit4ClassRunner.class)

@ContextConfiguration(locations = {"classpath:spring-config.xml", "classpath:spring-mybatis.xml"})
public class EmailTest {
    private static final Logger LOGGER = Logger.getLogger(UserTest.class);

    @Test
    public void can_send_email() throws GeneralSecurityException, MessagingException, InterruptedException {

        MailManage.addMail("1165479047@qq.com").newThreadToSentEmailForCheck();

        String checkNum = MailManage.getMail("1165479047@qq.com").getMailCheckString();
        LOGGER.debug("-------------->账户验证码："+checkNum);


        Thread.sleep(10000);
    }

}
